<?php include("src/addContractCompany_cs.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href='css/coolMessage.css' type='text/css' rel='stylesheet' media='screen' />
<title>Adicionar Contrato Compania:: ASSC</title>
<script language="javaScript" type="text/javascript" src="js/jquery.js"></script>
<script language="javaScript" type="text/javascript" src="js/jquery.simplemodal.js"></script>
<script language="javaScript" type="text/javascript" src="js/coolMessage.js"></script>

<link rel="stylesheet" type="text/css" media="all" href="includes/calendario/calendar-system.css" title="system" />
<script type="text/javascript" src="includes/calendario/calendar.js"></script>
<script type="text/javascript" src="includes/calendario/lang/calendar-es.js"></script>
<script type="text/javascript" src="includes/calendario/calendar-setup.js"></script>

<script language="javascript" type="text/javascript">
	
	var displayRow = '';
	if (navigator.appName == "Netscape")
		displayRow = 'table-row';
	else if (navigator.appName.indexOf("Explorer") != -1) 
		displayRow = 'block';
	
	var cont = 1;
	var maximum = 5
	function most(){
		document.getElementById("tr_phones").style.display = displayRow;
		if (cont < maximum ){
			cont++;
			$("#div_campo").append("<div id='div_tel_number_"+cont+"'>"+cont+". <input type='text' id='tel_number_"+cont+"' name='tel_number[]' class='text_grv' size='15' maxlength='14'/> <input type='text' id='tel_ext_"+cont+"' name='tel_ext[]' class='text_grv' size='3' maxlength='5'/></div>");
		}
		if(cont >0)
			document.getElementById('btnLess').disabled = 0;
	}
	
	function less(){
		if( cont == 2 )
			document.getElementById("tr_phones").style.display = 'none';
		
		if(cont > 1 ){
			$("#div_tel_number_"+cont).remove();
			cont--;
		}   
		if(cont == 1)
			document.getElementById('btnLess').disabled = 1;
	}
	
	function isMail(valor) {
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
			return (true);
		else
			return (false);
	}

	function validate(action){
		document.getElementById("action").value = action;//1: save, 2: save and continue.
		
		var msg = '';
		var hdvc_code 		= document.getElementById("hdvc_code").value;
		var coco_pay 		= document.getElementById("coco_pay").value;
		var coco_pay_value  = document.getElementById("coco_pay_value").value;
		var coco_date_in 	= document.getElementById("coco_date_in").value;
		var eps_code 	= document.getElementById("eps_code").value;
		var arp_code 	= document.getElementById("arp_code").value;
		var afp_code 	= document.getElementById("afp_code").value;
			
		if(hdvc_code == '') 
			msg='- Por favor entre la compania. <br />';
			
		if(coco_pay == '') 
			msg='- Por favor entre el periodo de pago. <br />';
		
		if(coco_pay_value == '') 
			msg='- Por favor entre el valor del pago. <br />';
			
		if(coco_date_in == '') 
			msg='- Por favor entre la fecha de contrato. <br />';
			
		if(eps_code == '') 
			msg= msg+'- Por favor entre la EPS. <br />';
		
		if(arp_code == '') 
			msg= msg+'- Por favor entre la ARP. <br />';	
			
		if(afp_code == '') 
			msg= msg+'- Por favor entre la AFP. <br />';		
	
//		if(cli_email == '') 
//			msg='- Please enter the email. <br />';
//		else{
//			if ( ! isMail (cli_email) )
//				msg += '- Wrong email.<br />';
//		}
		


		if(msg==''){
			document.getElementById('form').submit();
			return true;
		}
		else{
			coolMessage("alert", msg);
			return false;
		}		
	}
	

	function onlyNumbers(e)
	{
	   var key;
	   if(window.event)
		  key = window.event.keyCode;   //IE
	   else
		  key = e.which;                //firefox
	   if (!( (key >= 48 && key <= 57) || key ==8 || key ==9 || key ==0 || key ==46 ))
		  return false;
	   else
		  return true;
	}	
	
</script>
</head>
<body>
<?php $item_select = 13;include("menu.php");?><br />
    <form name="form" id="form" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="addContractCompany" id="addContractCompany" value="1"/>
	<input type="hidden" name="action" id="action" value="1"/>
    
    <div class="content_grv">
		<table width="80%" align="center" class="shadow">
            <tr>
                <td class="title">Informacion Contrato Compania</td>
            </tr>
            <tr>
                <td>
                    <table class="tbl_form" align="center">
                    <tr>
                            <td align="right"><span class="lbl_gray">Compania :</span></td>
                            <td>&nbsp;</td>
                            <td><select name="hdvc_code" id="hdvc_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($company);$i++) {?>
                                <option value="<?php echo $company[$i]->hdvc_code;?>"><?php echo $company[$i]->hdvc_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Tipo Contrato :</span></td>
                            <td width="1%">&nbsp;</td>
                            <td>
                            	<select name="coco_type" id="coco_type" class="text_grv">
                                    <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                    <option value="Indefinido">Indefinido</option>
                                    <option value="Temporal">Temporal</option>
                                    <option value="Temporal">Cooperativo</option>
                                    <option value="Temporal">Global</option>
                                    <option value="Temporal">Integral</option>
                                    <option value="Temporal">Servicios</option>
                                    <option value="Temporal">Tarea</option>
                                    <option value="Temporal">Inferior a un Ano</option>
                                    <option value="Temporal">3 Meses</option>
                            	</select>
                            </td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Valor Contrato :</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="coco_value" id="coco_value" class="text_grv" size="31" maxlength="30" /></td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Periodo Pago:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td>
                            	<select name="coco_pay" id="coco_pay" class="text_grv">
                                    <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                    <option value="Quincenal">Quincenal</option>
                                    <option value="Mensual">Mensual</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Valor :</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="coco_pay_value" id="coco_pay_value" class="text_grv" size="21" maxlength="20" /></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Fecha de Contrato:</span></td>
                            <td>&nbsp;</td>
                            <td><input name="coco_date_in" type="text" style="width:100px" readonly="readonly" id="coco_date_in" maxlength="45" class="text_grv"
				value="<?php if(isset($coco_date_in)) echo $coco_date_in?>"/>
			    <input name="imagea" type="image" id="calendar1" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td>
				<script type="text/javascript">
						Calendar.setup({
						inputField : "coco_date_in",							
						ifFormat : "%Y/%d/%m",
						showsTime : false,
						button : "calendar1", 
						step : 1
						});
				</script>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Fecha de terminacion:</span></td>
                            <td>&nbsp;</td>
                            <td><input name="coco_date_out" type="text" style="width:100px" readonly="readonly" id="coco_date_out" maxlength="45" class="text_grv"
				value="<?php if(isset($coco_date_out)) echo $coco_date_out?>"/>
			    <input name="imagea" type="image" id="calendar2" src="images/mostrar_calendario.png" align="absmiddle" width="18" height="16"/></td>
				<script type="text/javascript">
						Calendar.setup({
						inputField : "coco_date_out",							
						ifFormat : "%Y/%d/%m",
						showsTime : false,
						button : "calendar2", 
						step : 1
						});
				</script>
                        </tr>
						<tr>
                            <td align="right"><span class="lbl_gray">Adminsitracion:</span></td>
                            <td>&nbsp;</td>
                            <td>$ <input type="text" name="coco_admin" id="coco_admin" class="text_grv" size="21" maxlength="20"/></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">Aporte Mutual:</span></td>
                            <td>&nbsp;</td>
                            <td>$ <input type="text" name="coco_aporte_mutual" id="coco_aporte_mutual" class="text_grv" size="21" maxlength="20"/></td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">EPS:</span></td>
                            <td>&nbsp;</td>
                            <td><select name="eps_code" id="eps_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($eps);$i++) {?>
                                <option value="<?php echo $eps[$i]->eps_code;?>"><?php echo $eps[$i]->eps_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">ARP:</span></td>
                            <td>&nbsp;</td>
                            <td><select name="arp_code" id="arp_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($arp);$i++) {?>
                                <option value="<?php echo $arp[$i]->arp_code;?>"><?php echo $arp[$i]->arp_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td align="right"><span class="lbl_gray">AFP:</span></td>
                            <td>&nbsp;</td>
                            <td><select name="afp_code" id="afp_code" class="text_grv">
                                <option value="" selected="selected" disabled="disabled">Seleccione..</option>
                                <?php for($i=0; $i<count($afp);$i++) {?>
                                <option value="<?php echo $afp[$i]->afp_code;?>"><?php echo $afp[$i]->afp_name;?></option>
                                <?php }?>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Representante :</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="coco_rep" id="coco_rep" class="text_grv" size="51" maxlength="50" /></td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray">Representante cedula:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="coco_rep_ced" id="coco_rep_ced" class="text_grv" size="51" maxlength="50" /></td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray"> Telefono Representante:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="coco_rep_tel1" id="coco_rep_tel1" class="text_grv" size="51" maxlength="50" /></td>
                        </tr>
                        <tr>
                            <td width="35%" align="right"><span class="lbl_gray"> Telefono 2 Representante:</span></td>
                            <td width="1%">&nbsp;</td>
                            <td><input type="text" name="coco_rep_tel2" id="coco_rep_tel2" class="text_grv" size="51" maxlength="50" /></td>
                        </tr>
                        <tr>
                            <td valign="top" align="right"><span class="lbl_gray">Descripcion:</span></td>
                            <td>&nbsp;</td>
                            <td><textarea name="coco_description" id="coco_description" class="text_grv" cols="40" rows="7"></textarea></td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">&nbsp;</td>
                        </tr>
                        <tr>
                            <td colspan="3" align="center">
                                <input type="button" class="button_grv" value="Save" onclick="javascript: return validate(1);" />
                                <input type="button" class="button_grv" value="Save and continue" onclick="javascript: return validate(2);" />
                                <input type="reset" value="Reset" class="button_grv_cancel"/>
                                <input type="button" class="button_grv_cancel" value="Cancel" onClick="javascript:window.location.href='listContractCompany.php';" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
 	</div>
</form>    
</body>
</html>
<?php include('divscoolmessage.php');?>